package com.kgc.sbt.provider;

import com.alibaba.dubbo.config.annotation.Service;
import com.kgc.sbt.api.GoodsNoticeApi;
import com.kgc.sbt.mapper.GoodsMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created on 2021/6/23.
 * <p>
 * Author: yx
 * <p>
 * Description:
 */
@Service
public class GoodsNoticeProvider implements GoodsNoticeApi {

    @Autowired
    private GoodsMapper goodsMapper;
    @Override
    public boolean GoodsNoticeBooking(Integer userId, Integer goodsId) {

        if(goodsMapper.insertNoticeStock(userId,goodsId)>0){
            return true;
        }


        return false;
    }

    @Override
    public List<Integer> queryUserIdByGoodsId(Integer id) {
        return goodsMapper.selectUserIdByGoodsId(id);
    }

    @Override
    public String queryPhoneNoByUserId(Integer id) {
        return goodsMapper.selectPhoneNoByUserId(id);
    }

    @Override
    public boolean deleteNoticeByUserIdAndGoodsId(Integer userId, Integer goodsId) {

        if(goodsMapper.deleteNoticeByUserIdAndGoodsId(userId,goodsId)>0){
            return true;
        }
        return false;
    }

    @Override
    public Integer queryGoodsNum(Integer goodsId) {

        return goodsMapper.selectGoodsNum(goodsId);

    }


}
